﻿
function fullscreen() {
    elem = document.body;
    if (elem.webkitRequestFullScreen) {
        elem.webkitRequestFullScreen();
    } else if (elem.mozRequestFullScreen) {
        elem.mozRequestFullScreen();
    } else if (elem.requestFullScreen) {
        elem.requestFullscreen();
    } else {
        $('#prompt').append('浏览器不支持全屏。');
    }
}

window.onload = function () {
    $('body').prepend(
        '<img class="logo" src="Images/ghlogo240x160.png" alt="Logo" />' +
        '<h1>光华智能AGV云平台</h1>' +
        '<div class="menu">' +
        '<a href="Real.html">运行图</a>' +
        '<a href="Remote.html">遥控器</a>' +
        '<a href="State.html">AGV</a>' +
        '<a href="QRcode.html">扫码</a>' +
        '<a href="Task.html">任务</a>' +
        '<a href="Log.html">日志</a>' +
        '</div>'
    );

    $('.logo, h1').click(function () {
        window.location.href = 'Home.html';
    });


    // 登录框，放到window.onload的外面，否则不执行页面的点击事件
    var login = sessionStorage.getItem('login');
    if (login != 1) {
        $('html').append(   // 用$('body')显示不正常
            '<div class= "dlgground loginground" style="display: block">' +
            '<div class="dialog">' +
            '<div>请输入密码：</div>' +
            '<input type="password" id="LoginPassword" title="登录密码:" value="1111" />' +
            '<input type="button" id="LoginOK" value="确定" />' +
            '</div>' +
            '</div>'
        );

        $("#LoginOK").click(function () {
            sessionStorage.setItem('login', '1');
            //$.cookie('key', 'value', { expires: 7 });
            $(".dlgground").hide();
            logged();
        });
    }
    else {
        logged();
    }
}

// 空函数，在具体页面中重写
function logged() { }

